﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Framework.Db
{
    /// <summary>
    /// 数据库操作类
    /// </summary>
    public class DbHelper
    {
        /// <summary>
        /// 数据库类型
        /// </summary>
        public enum dbType
        {
            Orcale=0,
            Mysql,
            MSSQL_2000,
            MSSQL_2005
        }

        public static IDataProvider CreateDP()
        {
            string strDriver = Framework.Kit.AppOpr.GetConfigStrings("db_drive");
            //强制转换String 为  dbType
            dbType type = (dbType)Enum.Parse(typeof(dbType), strDriver, true);

            switch (type)
            {
                case dbType.Mysql:
                    return new MysqlHelper();
                case dbType.Orcale:
                    return new OracleHelper();
                default:
                    return null;
            }
        }
    }
}
